package com.heyun.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.heyun.bean.HeyunChildMenu;
import com.heyun.bean.HeyunMenu;
import com.heyun.bean.HeyunRoleMenu;
import com.heyun.dao.HeyunChildMenuDao;
import com.heyun.service.HeyunChildMenuService;
@Service
public class HeyunChildMenuImpl implements HeyunChildMenuService {
	 public static void main(String[] args) {
		ApplicationContext context=new ClassPathXmlApplicationContext("config/spring-default.xml");
		HeyunChildMenuService hycms=(HeyunChildMenuService) context.getBean("heyunChildMenuImpl");
		Map map=new HashMap();
		map.put("roleId", 1);
		map.put("menuId", 1);
		List<HeyunChildMenu> list=hycms.listChildMenu(map);
		for(HeyunChildMenu l:list){
			System.out.println(l.getChildMenuName());
		}
	}
	
    @Autowired
    HeyunChildMenuDao hycmd;
    
	@Override
	public List<HeyunMenu> listMenu() {
		// TODO Auto-generated method stub
		List<HeyunMenu>list=hycmd.listMenu();
		return list;
	}

	@Override
	public List<HeyunChildMenu> listChildMenu(Map map) {
		// TODO Auto-generated method stub
		List<HeyunChildMenu>list=hycmd.listChildMenu(map);
		return list;
	}

	@Override
	public HeyunChildMenu getChildMenu(int childMenuId) {
		// TODO Auto-generated method stub
		HeyunChildMenu hycdm=hycmd.getChildMenu(childMenuId);
		return hycdm;
	}
  
	@Override
	public List<HeyunChildMenu> getChindMenuByMenuId(int menuId) {
		// TODO Auto-generated method stub
		List<HeyunChildMenu>list= hycmd.getChindMenuByMenuId(menuId);
		return list;
	}

	@Override
	public List<HeyunChildMenu> listAllChildMenu() {
		// TODO Auto-generated method stub
		List<HeyunChildMenu>list=hycmd.listAllChildMenu();
		return list;
	}

	@Override
	public int giveNewPower(HeyunRoleMenu hyrm) {
		// TODO Auto-generated method stub
		int a =hycmd.giveNewPower(hyrm);
		return a;
	}

	@Override
	public List<HeyunRoleMenu> listRolePower(int roleId) {
		// TODO Auto-generated method stub
		List<HeyunRoleMenu> list=hycmd.listRolePower(roleId);
		return list;
	}

	@Override
	public int removePower(HeyunRoleMenu hyrm) {
		// TODO Auto-generated method stub
		int a =hycmd.removePower(hyrm);
		return a;
	}

}
